//- Copyright (c) 2016 Lucky Byte, Inc.
input(type="hidden" name="serial" value="#{record.serial || ''}")
input(type="hidden" name="uuid" value="#{record.uuid || ''}")

input(type="hidden" name="record"
  value="#{record ? JSON.stringify(record) : ''}")

h4.ui.dividing.header
  i.caret.down.icon.link.grey.accordion
  | 基本信息

.fields
  .field.sixteen.wide.required
    label 终端隶属商户:
      a.linkto(href="/merch") 配置商户
    .ui.dropdown.selection.search.merid
      input(type="hidden" name="merid")
      i.icon.dropdown
      .default.text 请选择
      .menu
        for merid in merids
          .item(data-value="#{merid.uuid}"
            data-inside="#{merid.inside}" data-chnl="#{merid.chnl}")
            - var color = merid.shaded ? 'orange' : '#888'
            span.right.floated(style="color:#{color}; font-size:small;")
              | #{merid.merno} ｜ 
              | #{merid.inside ? '平台商户' : '外联商户'} ｜ 
              | #{constant.merch_chnls[merid.chnl]}
            = merid.name

.fields
  .field.four.wide.required
    label.ui 终端编号:
    .ui.input
      input(type="text" name="termid" placeholder="必填")

  .field.two.wide
    label MAC算法:
      i.icon.help.link.blue(
        data-content="当此终端用在透传模式下时，不需要配置MAC算法及终端密钥"
        data-variation="small very wide")
    select.ui.dropdown.input(name="macalgo")
      option(value="1") 1. ECB

  .field.ten.wide
    label 终端主密钥: 
    .ui.input.right.labeled.left.icon#tmk
      i.icon.unhide.link.eyes(data-hide='true')
      input(type="hidden" name="tmk_old" value="#{record.tmk || ''}")
      input.real(type="hidden" name="tmk")
      input.show(type="text" name="tmk_hide"
        value="#{record.tmk ? '••••••••' : '' }"
        readonly="readonly" placeholder="留空表示无")
      a.ui.tag.label.red#tmk_gen 随机生成

.fields
  .field.sixteen.wide
    label 外联终端：
      i.icon.help.link.blue(
        data-content="转发交易到第三方时映射为此终端，仅在重组模式下有意义"
        data-variation="small very wide")
    .ui.dropdown.search.selection.disabled.mapto_term
      i.icon.random
      input(type="hidden" name="mapto_term")
      i.icon.dropdown
      .default.text 
      .menu

h4.ui.dividing.header
  i.caret.down.icon.link.grey.accordion
  | 备注信息

.fields
  .field.sixteen.wide
    textarea(name="notes" type="text" rows="3"
      placeholder="在此进行更多描述")= record.notes || ''
